package etude.collecteur;


/**
 * creation d'un cycle d'execution : Collecter, Analyser et Ecrire.
 * @author anthonyestebe
 *
 */
public class Task {
	private Analyzeur instanceAnalyzeur;
	private Collector instanceCollector;
	private Writer instanceWriter;
	
/**
 * initialisation par construction de la classe.
 * 
 * @param instance_Creation_de_fichier
 * @param instanceanalyzeur
 * @param instanceCollector
 * @param instanceWriter
 */
	public Task( Analyzeur instanceanalyzeur, Collector instanceCollector,
			Writer instanceWriter) {
		super();
		this.instanceAnalyzeur = instanceanalyzeur;
		this.instanceCollector = instanceCollector;
		this.instanceWriter = instanceWriter;
	}
	
	/**
	 * Fonction permettant l'execution de la tache.
	 */
	public void executeTask(){
		
		byte[] fichiercollecter = instanceCollector.collect();
				
		Statistic[] stats = instanceAnalyzeur.analyze(fichiercollecter);
		
		instanceWriter.ecrire(stats);
		
	}
}
